/*****************************************************************************
 * ratecontrol.h: ratecontrol
 *****************************************************************************
 * Copyright (C) 2003-2010 zmvc project
 *
 * Authors: Loren Merritt <lorenm@u.washington.edu>
 *          Laurent Aimar <fenrir@via.ecp.fr>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
 *
 * This program is also available under a commercial proprietary license.
 * For more information, contact us at licensing@zmvc.com.
 *****************************************************************************/

#ifndef Zmvc_RATECONTROL_H
#define Zmvc_RATECONTROL_H

int  zmvc_ratecontrol_new   ( zmvc_t * );
void zmvc_ratecontrol_delete( zmvc_t * );

void zmvc_ratecontrol_init_reconfigurable( zmvc_t *h, int b_init );

void zmvc_adaptive_quant_frame( zmvc_t *h, zmvc_frame_t *frame, float *quant_offsets );
int  zmvc_macroblock_tree_read( zmvc_t *h, zmvc_frame_t *frame, float *quant_offsets );
int  zmvc_reference_build_list_optimal( zmvc_t *h );
void zmvc_thread_sync_ratecontrol( zmvc_t *cur, zmvc_t *prev, zmvc_t *next );
void zmvc_ratecontrol_start( zmvc_t *, int i_force_qp, int overhead );
int  zmvc_ratecontrol_slice_type( zmvc_t *, int i_frame );
void zmvc_ratecontrol_set_weights( zmvc_t *h, zmvc_frame_t *frm );
void zmvc_ratecontrol_mb( zmvc_t *, int bits );
int  zmvc_ratecontrol_qp( zmvc_t * );
int  zmvc_ratecontrol_mb_qp( zmvc_t *h );
int  zmvc_ratecontrol_end( zmvc_t *, int bits, int *filler );
void zmvc_ratecontrol_summary( zmvc_t * );
void zmvc_ratecontrol_set_estimated_size( zmvc_t *, int bits );
int  zmvc_ratecontrol_get_estimated_size( zmvc_t const *);
int  zmvc_rc_analyse_slice( zmvc_t *h );
int zmvc_weighted_reference_duplicate( zmvc_t *h, int i_ref, const zmvc_weight_t *w );
void zmvc_threads_distribute_ratecontrol( zmvc_t *h );
void zmvc_threads_merge_ratecontrol( zmvc_t *h );
void zmvc_hrd_fullness( zmvc_t *h );
#endif

